{  Statement: http://acmp.ru/?main=task&id_task=95
   Verdict: Accepted
}
uses
        SysUtils, Math;

var
    t,cur,ans,i,ls:longint;
    s:string;

begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(S);
if length(s) = 1 then begin
    write(s,' ',0);
    halt(0);
end;
ans := 1;
cur := 0;
ls := length(s);
for i := 1 to ls do
    inc(cur, ord(s[i]) - 48);
while cur > 9 do begin
    t := cur;
    inc(ans);
    cur := 0;
    while t > 0 do begin
        inc(cur, t mod 10);
        t := t div 10;
    end;
end;
write(cur,' ',ans);
end.